<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>添加活动场次关联商品页面</title>
<link rel="stylesheet" href="layui/css/layui.css" />
</head>
<body>
	<form class="layui-form"  style="margin-top: 20px;">
	<div class="layui-form-item">
			<label class="layui-form-label">商品场次：</label>
			<div class="layui-input-inline">
				<input type="text" name="actp_id" id="actp_id" required
					lay-verify="required" class="layui-input">
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">商品名称：</label>
			<div class="layui-input-inline">
				<input type="text" name="p_id" id="p_id" required
					lay-verify="required" class="layui-input">
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">活动名称：</label>
			<div class="layui-input-inline">
				<select name="as_id" id="as_id" required
					lay-verify="required" lay-verify="" lay-search >
					<option value="">请输入活动名称</option>
					<option value="1">限时特卖</option>
					<option value="2">每日疯抢</option>
					<option value="3">欢乐双十二</option>
				</select>
			</div>
		</div>

		<div class="layui-form-item">
			<div class="layui-input-block">
				<button class="layui-btn" lay-submit lay-filter="forDemo">提交</button>
				<button type="reset" class="layui-btn layui-btn-primary">重置</button>
			</div>
		</div>
	</form>
	<script type="text/javascript" src="layui/layui.js"></script>
	<script>
		layui.use([ 'form', 'upload' ], function() {
			var form = layui.form;
			var $ = layui.jquery;
			var upload = layui.upload;

			//监听提交
			form.on('submit(forDemo)', function(data) {
				var d = data.field;
				d.method = "addActivityProduct";
				console.log(d);
				var url = '/wk1un2_electricity_digital/Backstage/addActivityProduct';
				$.post(url, d, function(data) {
					if (data.count > 0) {
						console.log('添加成功');
						var index = parent.layer.getFrameIndex(window.name);
						parent.layer.close(index);
					}
				}, "json");
				return false;
			});
		});
	</script>
	
</body>
</html>